package com.mayihr.fx.attributeBind.highClassBinding;

import javafx.beans.binding.DoubleBinding;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;

public class lowerClassBinding {
    public static void main(String[] args) {
        final DoubleProperty a = new SimpleDoubleProperty();
        final DoubleProperty b = new SimpleDoubleProperty();
        final DoubleProperty c = new SimpleDoubleProperty();
        final DoubleProperty d = new SimpleDoubleProperty();

        DoubleBinding db= new DoubleBinding() {
            {
                super.bind(a,b,c,d);
            }

            @Override
            protected double computeValue() {
                System.out.println(a.get()+","+a.getValue()+","+a.getName());
                System.out.println(b.get()+","+b.getValue()+","+b.getName());
                System.out.println(c.get()+","+c.getValue()+","+c.getName());
                System.out.println(d.get()+","+d.getValue()+","+d.getName());
                return (a.get() * b.get()) + (c.get() * d.get());
            }
        };
        System.out.println(db.get());
        b.set(3);
        a.set(1);
        System.out.println(db.get());
    }

}
